﻿using FluentNHibernate.Mapping;
using EntitiesAndMappings.Entities;
using System;

namespace EntitiesAndMappings.Maps
{
    public class ArticuloMap : ClassMap<Articulo>
    {

        public ArticuloMap()
        {

            Id(x => x.Id).GeneratedBy.Native();

            Map(x => x.Codigo).Unique().Not.Nullable();

            Map(x => x.Descripcion).Not.Nullable();

            References(x => x.SubFamilia).LazyLoad(Laziness.False).Not.Nullable();

            References(x => x.Marca).LazyLoad(Laziness.False).Not.Nullable();

            Map(x => x.Modelo).Not.Nullable();

            Map(x => x.Serie).Not.Nullable();

            References(x => x.TipoMantenimiento).LazyLoad(Laziness.False).Not.Nullable();

            Map(x => x.FrecuenciaMantenimiento).Not.Nullable();

            Map(x => x.StockMinimo).Not.Nullable();
            
            References(x => x.UnidadMedida).LazyLoad(Laziness.False).Not.Nullable();

            Map(x => x.Observaciones).Nullable();

            Map(x => x.Partes).Not.Nullable();

            Map(x => x.PartesTexto).Not.Nullable();

            Map(x => x.Consumible).Not.Nullable();
            
            Map(x => x.ConsumibleTexto).Not.Nullable();

            Map(x => x.RutaArchivoImagen).Not.Nullable();
            
            Map(x => x.Estado).Not.Nullable();
        }
        


       
    }
}
